GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( d31101...5680bf )
by Aleksey
03:52
created

$(document).pjax:complete   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
(function ($, app) {
2
    'use strict';
3
4
    $.extend(app, {
5
        PJAX_FLASH_CONTAINER: '.notification-container',
6
        PJAX_FLASH: 'pjax-flashes',
7
        PJAX_FLASH_SELECTOR: '[data-pjax-flashes]',
8
9
        MESSAGE_SUCCESS: 0,
10
        MESSAGE_ERROR: 1,
11
        MESSAGE_WARNING: 2,
12
        MESSAGE_NOTICE: 3,
13
14
        message: function (text, status) {
15
            this.clearMessage();
16
            if (!status) {
17
                status = this.MESSAGE_SUCCESS;
18
            }
19
20
            var msgbox = $('<div></div>').appendTo(app.PJAX_FLASH_CONTAINER);
21
            msgbox.addClass('alert');
22
            msgbox.hide();
23
            msgbox.text(text);
24
            switch (status) {
0 ignored issues
show
Coding Style introduced by
As per coding-style, switch statements should have a default case.
Loading history...
25
                case this.MESSAGE_SUCCESS :
26
                case 'success' :
27
                    msgbox.addClass('alert-success');
28
                    break;
29
                case this.MESSAGE_NOTICE :
30
                case 'notice' :
31
                    msgbox.addClass('alert-info');
32
                    break;
33
                case this.MESSAGE_WARNING :
34
                    msgbox.addClass('alert-warning');
35
                    msgbox.html('<i class="icon-warning-sign"></i> ' + msgbox.text());
36
                    break;
37
                case this.MESSAGE_ERROR :
38
                case 'error' :
39
                    msgbox.addClass('alert-danger');
40
                    msgbox.html('<i class="icon-erroralt"></i> ' + msgbox.text());
41
                    break;
42
            }
43
44
            msgbox.data("time", new Date());
45
            msgbox.fadeIn(500);
46
47
        },
48
49
        clearMessage: function () {
50
            $(app.PJAX_FLASH_CONTAINER + ' > div').each(function () {
51
                var time = $(this).data("time");
52
                if (!time || (new Date() - time >= 5 * 1000)) {
53
                    $(this).fadeOut(1000, function () {
54
                        $(this).html("");
55
                    });
56
                }
57
            });
58
        }
59
    });
60
61
    $(document)
62
        .on('pjax:send', app.clearMessage)
63
        .on('pjax:error', function (event, xhr, textStatus, error, options) {
0 ignored issues
show
Unused Code introduced by
The parameter options is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter error is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
64
            if ('abort' !== textStatus) {
65
                app.message('Error', app.MESSAGE_ERROR);
66
            }
67
        })
68
        .on('pjax:beforeReplace', function (event, contents, options) {
0 ignored issues
show
Unused Code introduced by
The parameter options is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
69
            var tmp = $('<div></div>');
70
            tmp.html(contents);
71
            var flashes = $(app.PJAX_FLASH_SELECTOR, tmp);
72
            if (flashes) {
73
                var flashData = flashes.data(app.PJAX_FLASH);
74
                if (flashData) {
75
                    $(app.PJAX_FLASH_CONTAINER).html(flashData);
76
                }
77
                flashes.removeData(app.PJAX_FLASH);
78
                flashes.removeAttr('data-' + app.PJAX_FLASH);
79
            }
80
        });
81
82
})(jQuery, application);
0 ignored issues
show
Bug introduced by
The variable application seems to be never declared. If this is a global, consider adding a /** global: application */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
83